import { MidSurfaceThicknessOptions } from "./engine.interface";
import { Edge } from "./../../../node_modules/cax-base/dist/interface.d";
import type { VTActor } from "cax-base";
import { SelectedEdgeInfo, SelectedParts, TEMPLATE_TYPE } from "../interface";

export enum MODEL_TYPE {
  VTK = "vtk",
  VTU = "vtu",
  VTP = "vtp",
  STL = "stl",
  GY = "gy",
  TEST_GY = "test_gy",
}

export interface CurveMeshOptions {
  // # 设置是否对齐
  alignment?: number;
  // # 设置是否亲近
  enableProximity?: number;
  // # 设置最大边长比
  maxLengthRatio?: number;
  // # 设置加密角度
  refinementAngle?: number;
  // # 尺寸优先级
  sizePriority?: number;
}

export interface SurfaceMeshOptions {
  // 设置是否自适应曲
  adaptiveCurvature?: number;
  // 设置是否允许无效四边形
  allowInvalidQuad?: number;
  // 设置单元类型
  elemType?: string;
  // 设置是否亲近
  enableProximity?: number;
  // 设置是否强制使用FastAFT
  forceAFT?: number;
  // 设置增长率
  growthRatio?: number;
  // 设置最大层数
  maxNumLayer?: number;
  // 设置尺寸优先级
  sizePriority?: number;
  // 相对尺寸
  meshSizePercentOfBBox?: number;
}

export interface MeshCreateOptions {
  // ! 实际为partId
  entityId?: number;
  meshIds?: Array<number>;
  surfaceMeshOptions?: SurfaceMeshOptions;
  curveMeshOptions?: CurveMeshOptions;
  isSubdivision?: number;
}

export interface FileLoadOptions {
  // ! 实际为partId
  path: string;
  type: string;
  append: boolean;
  importType: TEMPLATE_TYPE; // geometry或者nastran，nastran对应bdf文件
  loadColor?: 1 | 0;
  removeAbundantVertices?: 1 | 0;
  partition?: 1 | 0;
  splitCompMethod?: number;
  unitLength?: number;
  scale?: number;
  fuse?: 1 | 0;
  stitch?: {
    autoStitchTol: 1 | 0;
    nonManifold: 1 | 0;
    stitchAll: 1 | 0;
    stitchTol: number;
  };
}

export interface FileSaveOptions {
  Path: string;
  DisplayOnly: 1 | 0;
}

export interface SelectedPartsOptions {
  selectedPartsOptions?: SelectedParts[];
}

export interface CounterBoreOptions {
  // ! 实际为partId
  path: string;
  type: string;
}

export interface RemeshOptions {
  // ! 实际为partId
  entityId?: number;
  meshIds?: Array<number>;
  meshSize?: number;
  eleType?: string;
  sizeType?: string;
  refinementParams?: any;
}
// 重节点检查
export interface CheckOptions {
  // ! 实际为partId
  entityId?: number;
  meshIds?: Array<number>;
  meshSize?: number;
  eleType?: string;
}

export interface AnalysisOptions {
  minRadius?: number;
  maxRadius?: number;
}

export interface MidSurfaceOptions {
  partId?: number;
  location?: number;
  maxoffset?: number;
  partEntityId?: number;
}
export interface MidSurfaceThicknessOptions {
  partId?: number;
  entityId?: number;
  meshPartId?: number;
  meshIds?: Array<number>;
  selectedOption: string;
  middleGrid: string;
  thickness: string;
  attributeType: string;
  prefix: string;
  minimumThickness: boolean;
  maximumThickness: boolean;
  averageThickness: boolean;
  thicknessDistance: string;
  maxIntervalRange: string;
  spacingSelect: string;
  initial: string;
  fixation: string;
  thicknessSelect: string;
  setOffset: boolean;
  offsetSelect: string;
  offsetInput: string;
}

export interface EdgePartitionOptions {
  number?: number;
  meshSize?: number;
  bias?: {
    direction: number;
    number: number;
    ratio: number;
  };
  // }{
  //   edgeIds?: number[];
  //   partIds?: number[];
  //   edges?: SelectedEdgeInfo[];
  //   pointNum: string;
  //   partitionType: number;
}

export interface IDManagerOptions {
  action?: string;
  entityType?: string;
  increment?: number;
  startId?: number;
  offsetValue?: number;
}

export enum COMMAND_STATUS {
  BEGIN = 0,
  RUNNING = 2,
  FINISHED = 2,
}

export enum MESH_TYPE {
  ETRI = "Etri",
  RTRI = "Rtri",
  QUAD_TRI = "QuadTri",
  QUAD_TRI2 = "QuadTri2",
  QUAD_ALL = "QuadAll",
  POLYGON = "Polygon",
}
export enum ENTITY_TYPE {
  GEOM_BODY = 1, //实体
  FACE = 2, //面
  EDGE = 8, //线
  VERTEX = 32, //点
}

export interface FillHoleOptions {
  checkNormal?: 0 | 1;
  smooth?: 0 | 1;
  together?: 0 | 1;
}

export interface WasherCreateOptions {
  type: string;
  metaData: {
    types?: string[];
    values?: number[];
    maxValues?: number[];
    minValues?: number[];
    numOfLayers?: number[];
  };
  boundaryLayer: 0 | 1;
  numOfLayers?: number;
}

export interface WasherClearOptions extends WasherCreateOptions {
  height1st: number;
}

export interface WasherFindOptions {
  minDiameter: number;
  maxDiameter: number;
}

export interface WasherSetHoleOptions {
  symbolType: 0 | 1;
  curveData: {
    maxValues: number[];
    minValues: number[];
    types: string[];
    values: number[];
  };
}

export interface Meshextrude2dAddEntityOptions {
  entityId: number;
  entityType: number;
  partId: number;
}

export interface Meshextrude2dPreviewOptions {
  dir: string;
  method: string;
  segment: number;
  tessmethod?: string;
  tessnum?: number;
  tesssize?: number;
  close?: 0 | 1;
  sort?: 0 | 1;
  thickness: number;
}

export interface Meshextrude2dCreateOptions
  extends Meshextrude2dPreviewOptions {
  comp?: string;
}
export interface Meshextrude3dCreateOptions {
  comp?: string;
  dir: string;
  method: string;
  segment: number;
  thickness: number;
}
export interface PastenodeApplyOptions {
  method: string;
  pos: number;
  tol?: number;
}
export interface Sweep3dOptions {
  setName: string;
  segment: number;
}
export interface trimOptions {
  operation: string;
  orientation: number;
  toolObject: string;
  normalX: number;
  normalY: number;
  normalZ: number;
  sweepDepth: string;
  extendTrimmer: boolean;
  independentResults: boolean;
}

export interface TransformUpdateOptions {
  action: string;
  deleteOriginal: 0 | 1;
  dir: string;
  module: string;
  origin: string;
  repeatCount: number;
  withElems: 0 | 1;
  uniformScale?: 0 | 1;
  angle?: number;
  distance?: number;
  factor?: number;
}

export interface FreebodyReadFileOptions {
  path: string;
}
export interface FreebodyEnterOptions {
  maxNumSelection: number;
  setName: string;
}
export interface FreebodyEntity {
  id: number;
  name: string;
  check: "true" | "false";
}
export interface FreebodyFindNodesOptions {
  var: string;
  isfind: 1 | 0;
}

export interface FreebodyApplyOptions {
  autoFindInterfaceNodes: 0 | 1;
  createLoadBCs: 0 | 1;
  showSummary: 0 | 1;
  fileName: string;
  nodeSetName: string;
  selected_subcase_ids: string[];
  var: string;
}

export interface FreebodyTableDataOptions {
  fileName: string;
  var: string;
  createLoadBCs: boolean;
}
